clear
set more off
set mem 1g
# delimit ;
/*****************************************************************************************************************;
**This dofile starts from raw DHS data (DHS2004/BDKR4JDT/BDKR4JFL.DTA) and generates expandedDHSGPS_Mergedhh2007;

other pre-generated datasets this dofile also uses:
collapsedGPS2007
*****************************************************************************************************************/;

*****************************************************************************************************************;
*Paths;
*****************************************************************************************************************;

*access files in subdirectory generated by data creating dofiles;
local indataset "rawdta/DHS2007/BDKR51DT/BDKR51FL.DTA";

local outdataset "dtafiles/expandedDHSGPS_Mergedhh2007";

*****************************************************************************************************************;
*Main;
*****************************************************************************************************************;

use "`indataset'";

ren v001 dhsid07;
gen year=2007;

**HW: renames household variables**;
*breastfeeding;
ren v409 plainwater;
ren v411a babyformula;
ren v413 otherliq;
ren v413a sugarwater;
ren v413b cowgoat;
ren m4 durationbreast;
ren m5 monthsbreast;
ren hw1 childage;
ren b2 childbyear;

ren hw5 htasd;
ren hw11 wthtsd;

ren v113 watersource;
ren h11 diarrhea;

**HW: merge assigns well characteristics from cluster to household observation**;
merge m:1 dhsid07 using "dtafiles/collapsedGPS2007.dta";
drop _m;
save "`outdataset'",replace;


